#include <stdio.h>

#define TRACE(x...) 
#define PRINT(x...) TRACE(printf(x))

int dir;
int x, y;
int n, m;
int s;
char arena[110][110];
char ins;
int d[4][2] = {{-1,0}, {0,1}, {1,0}, {0,-1}};

int main() {
	while (1) {
		scanf("%d %d %d", &n, &m, &s);

		if (!n && !m && !s) break;

		for (int i=0; i<n; i++)
			scanf(" %s", arena[i]);

		TRACE(
			for (int i=0; i<n; i++) {
				for (int j=0; j<m; j++)
					printf("%c", arena[i][j]);
				printf("\n");
			}
		)

		dir=-1;

		for (int i=0; i<n; i++) {
			for (int j=0; j<m; j++) {
				switch (arena[i][j]) {
					case 'N':
						x=i; y=j;
						dir =0;
						break;
					case 'S':
						x=i; y=j;
						dir = 2;
						break;
					case 'L':
						x=i; y=j;
						dir = 1;
						break;
					case 'O':
						x=i; y=j;
						dir =3;
						break;
				}
	
				if (dir!=-1) break;
			}
			
			if (dir!=-1) break;
		}

		PRINT("%d %d %d\n", x, y, dir);

		int st=0;
		int nx, ny;

		while (s--) {
			scanf(" %c", &ins);

			switch (ins) {
				case 'D':
					dir++;
					dir%=4;
					break;
				case 'E':
					dir--;
					dir+=4;
					dir%=4;
					break;
				case 'F':
					nx= x+d[dir][0];
					ny= y+d[dir][1];
		
					if (nx>=0 && nx<n && ny>=0 && ny<m) {
						if (arena[nx][ny]!='#') {
							if (arena[nx][ny]=='*') {
								st++;
								arena[nx][ny]='.';
							}
							x=nx; y=ny;
						}
					}
					
					break;
			}

			PRINT("ins: %c; pos: %d, %d; dir: %d\n", ins, x, y, dir); 			
		}

		printf("%d\n", st);		
	}

	return 0;
}
